#Docker to package and containersise the backend. This will allow render to understand what exactly is needed to run the backend

#Build stage
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build


WORKDIR /src

COPY ["ExpenseWebApp.csproj", "./"]
RUN dotnet restore "ExpenseWebApp.csproj" 

COPY . .


RUN dotnet publish "ExpenseWebApp.csproj" \
	--configuration Release \
	--output /app/publish \
	/p:UseAppHost=false



# Runtime 

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime

WORKDIR /app

COPY --from=build /app/publish .

#render convention

EXPOSE 10000	

ENV ASPNETCORE_URLS=http://0.0.0.0:10000
ENV ASPNETCORE_ENVIRONMENT=Production

ENTRYPOINT ["dotnet", "ExpenseWebApp.dll"]
